/*
 * HashBucketSerializer.h
 *
 *  Created on: Oct 26, 2012
 *      Author: m
 */

#ifndef BUCKETSERIALIZER_H_
#define BUCKETSERIALIZER_H_

#include <cassert>
#include <memory>
#include "../../physical_layer/physical_layer_commons.h"
#include "../../physical_layer/ListSerializer.h"
#include "HashRecordSerializer.h"
#include "HashBucket.h"

class HashBucket;

class HashBucketSerializer : public physical::VariableSizeRecordSerializer<HashBucket>
{
private:
    // Serializador de HashRecords
    physical::ListSerializer<HashRecord>::_T_Serializer_ptr m_registerSerializer;

    // Serializador de lista de registros
    physical::ListSerializer<HashRecord> m_registerListSerializer;

public:
    HashBucketSerializer();
    ~HashBucketSerializer();

    size_t serialize( const HashBucket &element, physical::byteStream block );
    size_t deserialize( const physical::byteStream block, HashBucket &element );
    size_t computeSize( const HashBucket &element );

    size_t serialize( const _T_ptr &elementPtr, physical::byteStream block );
    size_t deserialize( const physical::byteStream block, _T_ptr &elementPtr );
    size_t computeSize( const _T_ptr &elementPtr );

};

#endif /* BUCKETSERIALIZER_H_ */
